package com.wang.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wang.mapper.CustomerFeedbackMapper;
import com.wang.pojo.CustomerFeedback;
import com.wang.response.PageResult;
import com.wang.response.Result;
import com.wang.response.ResultResponse;
import com.wang.service.CustomerFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 *
 */
@Service
@Transactional
public class CustomerFeedbackServiceImpl
    implements CustomerFeedbackService{
    @Autowired
    CustomerFeedbackMapper feedbackMapper;

    @Override
    public ResultResponse userFeedback(CustomerFeedback feedback) {
        feedbackMapper.insertFeedback(feedback);
        return ResultResponse.SUCCESS();
    }

    @Override
    public ResultResponse queryFeedback(Integer pageNum, Integer pageSize) {
        Page<CustomerFeedback> page = new Page<>(pageNum, pageSize);
        QueryWrapper<CustomerFeedback> queryWrapper = new QueryWrapper<>();
        Page<CustomerFeedback> page1 = feedbackMapper.selectPage(page, queryWrapper);
        return ResultResponse.SUCCESS(page1.getRecords(),page1.getTotal());
    }

    @Override
    public ResultResponse respond(CustomerFeedback feedback) {
        feedbackMapper.respond(feedback);
        return ResultResponse.SUCCESS();
    }

}




